//package com.lill.common.component.server.config;
//
//import org.apache.catalina.connector.Connector;
//import org.apache.coyote.http11.Http11NioProtocol;
//import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
//import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
//import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class TomcatNeedConfig {
//	
//	@Bean
//	public ConfigurableServletWebServerFactory webServerFactory() {
//		TomcatServletWebServerFactory tomcatFactory = new TomcatServletWebServerFactory();
//		tomcatFactory.addConnectorCustomizers(new NeedTomcatConnectorCustomizer());
//        return tomcatFactory;
//	}
//	
//	class NeedTomcatConnectorCustomizer implements TomcatConnectorCustomizer {
//
//		@Override
//		public void customize(Connector connector) {
//			Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
//			protocol.setAcceptCount(2048);//排队数
//			protocol.setMaxConnections(8192);//最大连接数
//			protocol.setMaxThreads(32768);//线程池的最大线程数
//			protocol.setMinSpareThreads(1024);//最小线程数
//			protocol.setConnectionTimeout(30000);//超时时间
//		}
//	}
//	
//}
